<?php
/* @var $this UserController */
/* @var $model Register1 */
/* @var $form CActiveForm  */

$this->pageTitle = Yii::app()->name . ' - Save Image';
$this->breadcrumbs = array(
    'Save Image',
);
if ($imageInCollection != null) {
    foreach ($imageInCollection as $iic) {
        if ($iic->collection->user_created == Yii::app()->user->id) {
            echo 'Ảnh này đã có trong Collection ' . CHtml::link($iic->collection->name, array('collection/view', 'id' => $iic->collection_id)) . ' của bạn.<br>';
            echo CHtml::link('Back', array('site/index'));
        }else{
            echo 'abc<br/>';
        }
    }
    
} else {
    echo $image->title . '<br>';
    echo '<img width="350px" src="' . Yii::app()->baseUrl . '/upload/user/' . $image->userCreated->id . '/images/' . $image->img_url . '" /><br>';
    ?>
    <h1>Save Image</h1>
    <div class="form">
        <?php
        $form = $this->beginWidget('CActiveForm', array(
            'id' => 'collection-form',
            'enableClientValidation' => true,
            'clientOptions' => array(
                'validateOnSubmit' => true,
            ),
        ));
        ?>
        <div class="row">
            <?php echo $form->labelEx($model, 'collection_id'); ?>
            <?php echo $form->dropDownList($model, 'collection_id', $collections); ?>
            <?php echo $form->error($model, 'collection_id'); ?>
        </div>

        <div class="row buttons">
            <?php
            echo CHtml::link('Create Collection', array('collection/create')) . '<br>';
            echo CHtml::submitButton('Save') . '<br>';
            echo CHtml::link('Back', array('site/index')) . '<br>';
            ?>

        </div>

        <?php $this->endWidget(); ?>
    </div><!-- form -->
<?php } ?>

